package dyyx.util;

import java.util.Date;

import javax.servlet.ServletContextEvent;
import javax.servlet.ServletContextListener;

public class WebContextListener implements ServletContextListener{
	
	public void contextInitialized(ServletContextEvent event) {
		System.out.println(this.getClass().getSimpleName()+".init run,"+new Date());
		
		String realPath = event.getServletContext().getRealPath("/");
		System.out.println("realPath="+realPath);
		
		if(CommUtil.isBlank(realPath)){
			throw new RuntimeException("webRootPath is blank");
		}
		WebUtil.setWebRootDir(realPath);
		System.out.println("startTime="+RunStatusUtil.runStatus.startTime);
		
		System.out.println("helloService="+WebAppContextUtil.getHelloService());

    	
	}
	
	public void contextDestroyed(ServletContextEvent event) {
		
	
		System.out.println(this.getClass().getSimpleName()+".contextDestroyed run "+System.currentTimeMillis());
    	
	}
}